package chan2client

import (
	"starsine.cn/appTpl/cmn/logs"
	"starsine.cn/appTpl/svclog/src/fe/clientinfo"
	"starsine.cn/appTpl/svclog/src/fe/ws-server/wsserver"
)

var ws2ClientMap *Ws2ClientMap = nil

func Start() {
	ws2ClientMap = CreateWs2ClientMap()

	logs.Infof("registry.wshandler start")
}

func DumpWs2ClientMap() string {
	return ws2ClientMap.Dump()
}

func AddWsClient(c *wsserver.WsServer, s *clientinfo.ClientInfo) {
	ws2ClientMap.AddWsClient(c, s)
}

func DelWsClient(s *clientinfo.ClientInfo) {
	ws2ClientMap.DelWsClient(s)
}

func DelWsConn(c *wsserver.WsServer) {
	ws2ClientMap.DelWsConn(c)
}

func GetUserFromWsConn(c *wsserver.WsServer) (*clientinfo.ClientInfo, bool) {
	return ws2ClientMap.GetUserFromWsConn(c)
}
